home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / User::pwent.Z / User::pwent
Encoding:
Text File  |  1998-10-28  |  3.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      UUUUsssseeeerrrr::::::::ppppwwwweeeennnntttt((((3333))))  22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))    UUUUsssseeeerrrr::::::::ppppwwwweeeennnntttt((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       User::pwent -    by-name    interface to Perl's built-in getpw*()
  10.       functions
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.        use User::pwent;
  14.        $pw = getpwnam('daemon') or die "No daemon user";
  15.        if (    $pw->uid == 1 && $pw->dir =~ m#^/(bin|tmp)?$# )    {
  16.            print "gid 1 on root dir";
  17.        }
  18.  
  19.        use User::pwent qw(:FIELDS);
  20.        getpwnam('daemon') or die "No daemon    user";
  21.        if (    $pw_uid    == 1 &&    $pw_dir    =~ m#^/(bin|tmp)?$# ) {
  22.            print "gid 1 on root dir";
  23.        }
  24.  
  25.        $pw = getpw($whoever);
  26.  
  27.  
  28.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  29.       This module's    default    exports    override the core _g_e_t_p_w_e_n_t(),
  30.       _g_e_t_p_w_u_i_d(), and _g_e_t_p_w_n_a_m() functions,    replacing them with
  31.       versions that    return "User::pwent" objects.  This object has
  32.       methods that return the similarly named structure field name
  33.       from the C's passwd structure    from _p_w_d._h; namely name,
  34.       passwd, uid, gid, quota, comment, gecos, dir,    and shell.
  35.  
  36.       You may also import all the structure    fields directly    into
  37.       your namespace as regular variables using the    :FIELDS    import
  38.       tag.    (Note that this    still overrides    your core functions.)
  39.       Access these fields as variables named with a    preceding pw_
  40.       in front their method    names.    Thus, $passwd_obj->shell()
  41.       corresponds to $pw_shell if you import the fields.
  42.  
  43.       The _g_e_t_p_w() funtion is a simple front-end that forwards a
  44.       numeric argument to _g_e_t_p_w_u_i_d() and the rest to _g_e_t_p_w_n_a_m().
  45.  
  46.       To access this functionality without the core    overrides,
  47.       pass the use an empty    import list, and then access function
  48.       functions with their full qualified names.  On the other
  49.       hand,    the built-ins are still    available via the CORE::
  50.       pseudo-package.
  51.  
  52.      NNNNOOOOTTTTEEEE
  53.       While    this class is currently    implemented using the
  54.       Class::Struct    module to build    a struct-like class, you
  55.       shouldn't rely upon this.
  56.  
  57.      AAAAUUUUTTTTHHHHOOOORRRR
  58.       Tom Christiansen
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      UUUUsssseeeerrrr::::::::ppppwwwweeeennnntttt((((3333))))  22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))    UUUUsssseeeerrrr::::::::ppppwwwweeeennnntttt((((3333))))
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.      Page 2                        (printed 10/23/98)
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.